package com.hs.sfzy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hs.sfzy.entity.Answer;
import com.hs.sfzy.mapper.AnswerMapper;
import com.hs.sfzy.service.AnswerService;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName AnswerServiceImpl
 * @Description TODO
 * @Author liuzhuo
 * @Date 2025年08月13日 15:33
 * @Version 1.0
 */
@Service
public class AnswerServiceImpl implements AnswerService {
    @Autowired
    private AnswerMapper answerMapper;

    @Override
    public PageInfo<Answer> getAnswerList(Answer answer, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<Answer> list = answerMapper.getAnswerList(answer);
        return new PageInfo<>(list);
    }

    @Override
    public List<Answer> getAnswersByContent(String content) {
        Answer answer = new Answer();
        answer.setContent(content);
        List<Answer> answerList = answerMapper.getAnswerList(answer);

        return answerList;
    }
}
